//
//  YYECourseClassifyTableViewCell.m
//  YuYingEDU
//
//  Created by 胡波 on 2017/12/29.
//  Copyright © 2017年 胡波. All rights reserved.
//

#import "YYECourseClassifyTableViewCell.h"

@interface YYECourseClassifyTableViewCell ()

@property (nonatomic,strong) UIImageView *leftIV;
@property (nonatomic,strong) UILabel *nameLabel;

@end

@implementation YYECourseClassifyTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.leftIV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.leftIV];
        
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.textColor = [UIColor blackColor];
        self.nameLabel.font = [UIFont systemFontOfSize:14];
        self.nameLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.nameLabel];
        
//        self.nameLabel.text = @"网络技术";
        
    }
    return self;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.leftIV makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.equalTo(self.contentView);
        make.width.equalTo(3);
    }];
    
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.leftIV.right);
        make.top.bottom.right.equalTo(self.contentView);
    }];
    
}

- (void)setModel:(YYECourseLeftModel *)model {
    _model = model;
    
    self.nameLabel.text = model.CateName;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
    // 242,249,255
    if (selected) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.leftIV.image = [UIImage imageNamed:@"leftIndication"];
    }else {
        self.contentView.backgroundColor = [UIColor colorWithRed:242.0/255 green:249.0/255 blue:255.0/255 alpha:1];

        self.leftIV.image = [UIImage imageNamed:@"leftWhite"];
    }
    
}

@end
